<h1>Statistics</h1>
<ul>
	<li><a href="index.php?what=stats">General Statistics</a></li>
	<!--<li><a href="index.php?what=stats&amp;do=genre">Genre Statistics</a></li>
	<li><a href="index.php?what=stats&amp;do=members">Member Statistics</a></li>-->
</ul>

<h2>Movie Statistics</h2>
<ul>
<li>Number of movies: {$content.movies}</li>
<li>Number of directors: {$content.directors}</li>
<li>number of actors: {$content.actors}</li>
<li>number of writers: {$content.writers}</li>
</ul>

<h2>Movies Per Genre</h2>
<img src="index.php?what=stats&amp;do=graph&amp;type=moviespergenre" alt="graph" />

<h2>Movies Per Year</h2>
<p>Number of movies in the database from each year.</p>
<img src="index.php?what=stats&amp;do=graph&amp;type=moviesperyear" alt="graph" />

<h2>Popular Movies</h2>
<table>
	<tr>
		{if $content.popular.views != false}
		<td>
			<h3>By Views</h3>
			<table>
			<tr>
				<th>Title</th>
				<th>Views</th>
				<th>Owners</th>
				<th></th>
			</tr>
			{foreach from=$content.popular.views item=view}
			<tr>
				<td><a href="index.php?what=movie&amp;do=view&amp;id={$view.id}">{$view.title}</a> ({$view.year})</td>
				<td>{$view.views}</td>
				<td>{$view.owners}</td>
				<td>{imdb url=$view.imdb_url}</td>
			</tr>
			{/foreach}
			</table>
		</td>
		{/if}
		{if $content.popular.ratings != false}
		<td>
			<h3>By Ratings</h3>
			<table>
			<tr>
				<th>Title</th>
				<th>Rating</th>
				<th>Owners</th>
				<th></th>
			</tr>
			{foreach from=$content.popular.ratings item=view}
			<tr>
				<td><a href="index.php?what=movie&amp;do=view&amp;id={$view.id}">{$view.title}</a> ({$view.year})</td>
				<td>
					{if $config.ratings == '1'}
						{$view.ratings}
					{else}

					{/if}
				</td>
				<td>{$view.owners}</td>
				<td>{imdb url=$view.imdb_url}</td>
			</tr>
			{/foreach}
			</table>
		</td>
		{/if}
	</tr>
</table>

<h2>Recent Movies</h2>
<p>Movies added since the beginning of the month</p>
{if $content.new != false}
<table>
	<tr>
		<th>Title</th>
		<th>Owners</th>
		<th>Added</th>
		<th></th>
	</tr>
	{foreach from=$content.new item=new}
	<tr>
		<td><a href="index.php?what=movie&amp;do=view&amp;id={$new.id}">{$new.title}</a> ({$new.year})</td>
		<td>{$new.owners}</td>
		<td>{$new.created|date:$config.date_format_long}</td>
		<td>{imdb url=$new.imdb_url}</td>
	</tr>
	{/foreach}
</table>
{/if}

<h2>Misc Stats</h2>
<ul>
<li>Total Running time of movies: {$content.runtime.hours} Hours {$content.runtime.minutes} Minutes</li>
<li>Average running time: {$content.runtime_avg}</li>
</ul>
